import React from 'react'
import './index.less'
/**
 * 类别：组件
 * 功能：提供我的钱包分类标签
 * 示例：我的银行卡，我的账单，钱包余额
 */
class Switch extends React.Component <IChildProps,void>{
    constructor(props, context) {
        super(props, context);
        this.state = {
            switchIsOn : true
        }
    }

    changeSwitchStatus (){
        if (!this.props.disabled) { 
            this.props.handleClick(!this.props.value)
        }
        
    }

    render() {
        return (
            <div className={this.props.value == true ? 'switch-on' : 'switch-off'} onClick={this.changeSwitchStatus.bind(this)}>
            	<div className="switch-bg">
                    <div className="switch-point"/>
                    <div >
                        <div className="align-left switch-title float-left">开</div>
                        <div className="align-right switch-title float-right">关</div>
                    </div>
            	</div>
            </div>
        )
    }
}

export default Switch